$(function () {

    /*点击识别按钮，跳转至登录页面*/
    $(".container .button").click(function () {
        $.ajax({
            url: './i/home/user/islogin',
            type: 'GET',
            success: function(data) {
                if (data.data == true) {
                    window.location.href = './show.html'
                } else {
                    window.location.href = './login.html';
                }
            }
        })
        
    })
    var ratio = 1920/1080;
    var initiaScreenWidth = $(window).width(), initialScreenHeight = $(window).height();
    if (initiaScreenWidth/initialScreenHeight >= ratio) {
        initiaScreenWidth = ratio*initialScreenHeight;
    } else {
        initialScreenHeight = initiaScreenWidth/ratio;
    }
    $(".container").css({
        width: initiaScreenWidth,
        height: initialScreenHeight,
        top: ($(window).height() - initialScreenHeight)/2
    })


    



    $(window).resize(function(){
        var $this = $(this);
        
        var screenWidth = $this.width(), screenHeight = $this.height();
        var screenRatio = screenWidth/screenHeight;
        var lastWidth = screenWidth, lastHeight = screenHeight;


        if (screenRatio >= ratio) {
            lastWidth = ratio*screenHeight;
        } else {
            lastHeight = screenWidth / ratio;
        }

        $(".container").css({
            width: lastWidth,
            height: lastHeight,
            top: (screenHeight - lastHeight)/2
        })

    })
})